﻿using StoneAge.Controller.Routing;
using StoneAge.Controller.Storage;
using StoneAge.Controller.Request;
using StoneAge.DataContract.Messaging;

namespace StoneAge.Controller.Handlers
{
    abstract class RequestHandler
    {
        protected IHttpStorage Storage { get { return HttpStorageFactory.GetStorage(); } }

        private RequestHandler m_NextHandler = null;
        protected RequestHandler NextHandler { get { return m_NextHandler; } }

        private Route m_Route = null;
        protected Route Route { get { return m_Route; } }

        public RequestHandler() { }

        public RequestHandler(string route)
        {
            m_Route = new Route(route);
        }

        public RequestHandler SetNextHandler(RequestHandler requestHandler)
        {
            m_NextHandler = requestHandler;
            return m_NextHandler;
        }

        public abstract void Handle(WebRequest webRequest);
    }
}
